#include "Cooler.h"

Cooler::Cooler(uint8_t pin) : pin(pin), active(false) {
    pinMode(pin, OUTPUT);
    digitalWrite(pin, LOW);
}

const bool Cooler::isActive() const {
    return this->active;
}

void Cooler::updateState(bool active) {
    if (this->active != active) {
        this->active = active;

        digitalWrite(pin, (uint8_t) (active ? HIGH : LOW));
    }
}

const void Cooler::activate() {
   updateState(true);
}

const void Cooler::deactivate() {
   this->updateState(false);
}




